<?php

namespace app\index\model;

use app\common\controller\ossStorage;
use think\Db;
use think\Model;
class Coenvironment extends  Model {
    /**
     * 连接user表，外键公司id，判断当前登录的用户，查询相应字段，返回相应的数据
     * @copyright hyw
     * @param $phone
     * @return Coenvironment
     */
    public function getImgAttr($companyId) {
        $result = $this
            ->where('company_id','=',$companyId)
            ->field('coenviron_img')
            ->where('is_delete','=',0)
            ->order('coenviron_id desc' )
            ->select();
        return $result;
    }

    /**
     * @param $companyEnviron
     * @return void
     * @throws \Exception
     * ljj
     * 插入公司环境
     */
    public function insertEnviron($companyEnviron)
    {
        $this->saveAll($companyEnviron);
    }

    public function getEnvironAttr($companyId)
    {
        return $this->where([['company_id','=',$companyId],['is_delete','=','0']])->field('coenviron_img')->select();
    }
}